// ignore_for_file: prefer_const_constructors, prefer_const_literals_to_create_immutables
import 'package:flutter/material.dart';
import 'package:junyeyishu/ui/home/QGOrderConfirmPage.dart';
import '/utils/utils.dart';

class QGSaleOrderConfirmPage extends QGOrderConfirmPage {
  QGSaleOrderConfirmPage({super.key, super.args});
  @override
  State<QGOrderConfirmPage> createState() => _QGSaleOrderConfirmPageState();
}

class _QGSaleOrderConfirmPageState extends QGOrderConfirmPageState {
  @override
  onPay() {
    var param = {};
    param['cid'] = widget.args?["cid"];
    param['pay_type'] = "HUIFU";

Map<String, dynamic> stringMap = param.cast<String, dynamic>();
    Network.post(url_market_payOrder, data: stringMap, context: context)
        .then((res) async {
      if (!res.success) {
        toast(res.msg);
        return;
      }

      var url = res.data["pay_url"];
      if (url is String && !url.startsWith("http")) {
        url = url;
      }
      if (url is! String || !url.startsWith("http")) {
        toast("数据解析失败");
        return;
      }

      Navigator.of(context)
          .pushReplacementNamed(PageQGPayWebView, arguments: url);
    });
  }
}
